home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / MS Cobol4.5 / DEMO / ASMDEMO / ADD.CBL next >
Text File  |  1991-04-08  |  3KB  |  52 lines

  1.       $set mf ans85 noosvs
  2.       *******************************************************************
  3.       *                                                                 *
  4.       *                                                                 *
  5.       *                  (C) Micro Focus Ltd. 1989                      *
  6.       *                                                                 *
  7.       *                            ADD.CBL                              *
  8.       *                                                                 *
  9.       * This program shows how to call the assembler routine ADDEM.ASM. *
  10.       * It can be called dynamically as a .EXE or .DLL file, or         *
  11.       * statically linked.                                              *
  12.       *                                                                 *
  13.       * To statically link you must compile this program with the       *
  14.       * LITLINK directive (or change the call below to call "__addem"). *
  15.       *                                                                 *
  16.       * To dynamically link, compile the program as it is without the   *
  17.       * LITLINK directive. On OS/2 you must create a .DLL from          *
  18.       * ADDEM.OBJ using the .DEF file supplied, and place the .DLL file *
  19.       * in a directory on your LIBPATH.                                 *
  20.       *                                                                 *
  21.       * The assembler routine gets the value of the first parameter,    *
  22.       * adds it to the value of second-param and returns the result     *
  23.       * in res-ult.                                                     *
  24.       *                                                                 *
  25.       *******************************************************************
  26.  
  27.        working-storage section.
  28.        01 comp-fields.
  29.            03 first-param      pic 99 comp value 3.
  30.            03 second-param     pic 99 comp value 5.
  31.            03 res-ult          pic 99 comp.
  32.  
  33.        01 display-first-param  pic Z9.
  34.        01 display-second-param pic Z9.
  35.        01 display-res-ult      pic Z9.
  36.  
  37.        procedure division.
  38.  
  39.       * call to assembler routine
  40.            call "addem" using first-param, second-param, res-ult.
  41.  
  42.       *set up display fields
  43.            move first-param  to display-first-param.
  44.            move second-param to display-second-param.
  45.            move res-ult      to display-res-ult.
  46.  
  47.       * display results of the call
  48.            display display-first-param " + "
  49.                    display-second-param " = "
  50.                    display-res-ult.
  51.        stop run.
  52.